package designpatterns.adapter;

import lombok.extern.slf4j.Slf4j;

/**
 * @author root
 */
@Slf4j
public class AudioPlayer implements MediaPlayer {

    @Override
    public void play(String audioType) {
        //播放 mp3 音乐文件的内置支持
        if ("mp3".equalsIgnoreCase(audioType)) {
            log.info("Playing mp3 file. ");
        }
        //mediaAdapter 提供了播放其他文件格式的支持
        else if ("vlc".equalsIgnoreCase(audioType) || "mp4".equalsIgnoreCase(audioType)) {
            MediaAdapter mediaAdapter = new MediaAdapter(audioType);
            mediaAdapter.play(audioType);
        } else {
            log.info("Invalid media. {} format not supported", audioType);
        }
    }
}
